﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl x:Class="System.Windows.Controls.Samples.TimeUpDownSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Samples="clr-namespace:System.Windows.Controls.Samples" 
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit">
  <StackPanel Background="White">
    <ContentControl Content="Default" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"/>

    <ContentControl Content="Preselected time" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Value="13:00" Width="150" HorizontalAlignment="Left"/>

    <ContentControl Content="Preselected culture (13.30)" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:30" Culture="it-IT" />

    <ContentControl Content="Short Time Format" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:00" Format="Short"/>

    <ContentControl Content="Long Time Format" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:00" Format="Long"/>

    <ContentControl Content="Custom Time Format (tt h:mm)" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:00" Format="tt h:mm"/>

    <ContentControl Content="Minimum and maximum (8:22 AM to 2:55 PM)" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"
        Value="10:24 AM" 
        Minimum="08:22 AM"
        Maximum="02:55 PM" />

    <ContentControl Content="Non-Cylic, with minimum and maximum (8:22 AM to 2:55 PM)" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"
        IsCyclic="False"
        Value="10:24 AM" 
        Minimum="08:22 AM"
        Maximum="02:55 PM" />

    <ContentControl Content="Custom parsing (+/- 3h -> DateTime.Now.AddHours(+/- 3)" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left">
      <inputToolkit:TimeUpDown.TimeParsers>
        <inputToolkit:TimeParserCollection>
          <Samples:PlusMinusHourTimeParser />
        </inputToolkit:TimeParserCollection>
      </inputToolkit:TimeUpDown.TimeParsers>
    </inputToolkit:TimeUpDown>

    <ContentControl Content="Custom parsing (+/- 3m -> DateTime.Now.AddMinutes(+/- 3)" Style="{StaticResource Header}" />
    <inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left">
      <inputToolkit:TimeUpDown.TimeParsers>
        <inputToolkit:TimeParserCollection>
          <Samples:PlusMinusMinuteTimeInputParser />
        </inputToolkit:TimeParserCollection>
      </inputToolkit:TimeUpDown.TimeParsers>
    </inputToolkit:TimeUpDown>
    <src:SourceViewer xmlns:src="clr-namespace:System.Windows.Controls.Samples;assembly=System.Windows.Controls.Samples.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <src:SourceFile Path="TimeUpDownSample.xaml">
    <src:SourceFile.Source>
      <sys:String>&lt;!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
--&gt;

&lt;UserControl x:Class="System.Windows.Controls.Samples.TimeUpDownSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Samples="clr-namespace:System.Windows.Controls.Samples" 
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"&gt;
  &lt;StackPanel Background="White"&gt;
    &lt;ContentControl Content="Default" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"/&gt;

    &lt;ContentControl Content="Preselected time" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Value="13:00" Width="150" HorizontalAlignment="Left"/&gt;

    &lt;ContentControl Content="Preselected culture (13.30)" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:30" Culture="it-IT" /&gt;

    &lt;ContentControl Content="Short Time Format" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:00" Format="Short"/&gt;

    &lt;ContentControl Content="Long Time Format" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:00" Format="Long"/&gt;

    &lt;ContentControl Content="Custom Time Format (tt h:mm)" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left" Value="13:00" Format="tt h:mm"/&gt;

    &lt;ContentControl Content="Minimum and maximum (8:22 AM to 2:55 PM)" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"
        Value="10:24 AM" 
        Minimum="08:22 AM"
        Maximum="02:55 PM" /&gt;

    &lt;ContentControl Content="Non-Cylic, with minimum and maximum (8:22 AM to 2:55 PM)" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"
        IsCyclic="False"
        Value="10:24 AM" 
        Minimum="08:22 AM"
        Maximum="02:55 PM" /&gt;

    &lt;ContentControl Content="Custom parsing (+/- 3h -&gt; DateTime.Now.AddHours(+/- 3)" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"&gt;
      &lt;inputToolkit:TimeUpDown.TimeParsers&gt;
        &lt;inputToolkit:TimeParserCollection&gt;
          &lt;Samples:PlusMinusHourTimeParser /&gt;
        &lt;/inputToolkit:TimeParserCollection&gt;
      &lt;/inputToolkit:TimeUpDown.TimeParsers&gt;
    &lt;/inputToolkit:TimeUpDown&gt;

    &lt;ContentControl Content="Custom parsing (+/- 3m -&gt; DateTime.Now.AddMinutes(+/- 3)" Style="{StaticResource Header}" /&gt;
    &lt;inputToolkit:TimeUpDown Width="150" HorizontalAlignment="Left"&gt;
      &lt;inputToolkit:TimeUpDown.TimeParsers&gt;
        &lt;inputToolkit:TimeParserCollection&gt;
          &lt;Samples:PlusMinusMinuteTimeInputParser /&gt;
        &lt;/inputToolkit:TimeParserCollection&gt;
      &lt;/inputToolkit:TimeUpDown.TimeParsers&gt;
    &lt;/inputToolkit:TimeUpDown&gt;
  &lt;/StackPanel&gt;
&lt;/UserControl&gt;</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="TimeUpDownSample.xaml.cs">
    <src:SourceFile.Source>
      <sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System.ComponentModel;

namespace System.Windows.Controls.Samples
{
    /// &lt;summary&gt;
    /// Sample for TimeUpDown.
    /// &lt;/summary&gt;
    [Sample("(2)TimeUpDown", DifficultyLevel.Basic)]
    [Category("TimePicker")]
    public partial class TimeUpDownSample : UserControl
    {
        /// &lt;summary&gt;
        /// Initializes a new instance of the &lt;see cref="TimeUpDownSample"/&gt; class.
        /// &lt;/summary&gt;
        public TimeUpDownSample()
        {
            InitializeComponent();
        }
    }
}
</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="TimeUpDownSample.xaml.vb">
    <src:SourceFile.Source>
      <sys:String>' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.

Imports Microsoft.VisualBasic
Imports System.ComponentModel

''' &lt;summary&gt;
''' Sample for TimeUpDown.
''' &lt;/summary&gt;
&lt;Sample("(2)TimeUpDown", DifficultyLevel.Basic), Category("TimePicker")&gt; _
Partial Public Class TimeUpDownSample
    Inherits UserControl
    ''' &lt;summary&gt;
    ''' Initializes a new instance of the &lt;see cref="TimeUpDownSample"/&gt; class.
    ''' &lt;/summary&gt;
    Public Sub New()
        InitializeComponent()
    End Sub
End Class
</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
</src:SourceViewer>
  </StackPanel>
</UserControl>